package com.blackfish.info;

import com.blackfish.common.model.Device;
import com.blackfish.common.model.Info;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import java.util.Date;

import java.util.List;

public class InfoService {
    static final Info dao = new Info().dao();
    static final Device deviceDao = new Device().dao();

    public List<Record> getDidByMid(int mid){
        List<Record> devices = Db.find("SELECT * FROM `device` WHERE id=(SELECT I.device_id FROM info as I where module_id="+mid+")");
        return devices;
    }

    public boolean creatInfo(int modId,int deviceId){
        return new Info().setModuleId(modId).setDeviceId(deviceId).setTime(new Date()).save();
    }


}
